<?php
/* @var $this OrderheaderController */
/* @var $model Orderheader */

$this->breadcrumbs=array(
	'Orderheaders'=>array('index'),
	$model->id,
);

if ((Yii::app()->user->type==="Admin")) {
$this->menu=array(
	array('label'=>'List Order', 'url'=>array('index')),
	array('label'=>'Create Order', 'url'=>array('create')),
	array('label'=>'Update Order', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete Order', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage Order', 'url'=>array('admin')),
);
}else if((Yii::app()->user->type==="Pharmacist")){
$this->menu=array(
array('label'=>'Add orderdetail', 'url'=>array('orderdetail/create','orderheader_id'=>$model->id)),
        //array('label'=>'Manage', 'url'=>array('admin')),
      //  array('label'=>'List', 'url'=>array('index')),
      //  array('label'=>'Update', 'url'=>array('update', 'id'=>$model->id)),
      //  array('label'=>'Create', 'url'=>array('create')),
        );
		}


$this->breadcrumbs=array(
	'Orderdetails'=>array('index'),
	$model->id,
);

$this->menu=array(
array('label'=>'Add orderdetail', 'url'=>array('orderdetail/create','orderheader_id'=>$model->id)),
	//array('label'=>'List Orderheader', 'url'=>array('index')),
	//array('label'=>'Create Orderheader', 'url'=>array('create')),
	//array('label'=>'Update Orderheader', 'url'=>array('update', 'id'=>$model->id)),
	//array('label'=>'Delete Orderheader', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	//array('label'=>'Manage Orderdetail', 'url'=>array('admin')),
);
?>

<h1>View Orderheader #<?php echo $model->id; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		'date',
		'patient.patient_lastname',
		//'order_total',
		'pharmacy.pharmacy_name',
		'employee.emp_lastname',
		'prescriptionheader_id',
			),
)); 
$order = Orderdetail::model()->findAll('orderheader_id= :a', array(':a'=>$model->id));
 if (count($order) !== 0){
$orderno = 0;
?>
<h2> Orderdetail <?php echo $model->id; ?></h2>
<?php foreach ($order as $row) { ?>
<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$row,
	'attributes'=>array(
		//'id',
		//'orderheader_id',
		//'product_id',
		'ordmedicine_qty',
		'order_medicine_price',
		//'order_sub_total',
		array('label'=>'sub total', 'value'=> $row->ordmedicine_qty * $row->order_medicine_price,),
		//$totalPrice = ( 'order_medicine_price' * 'ordmedicine_qty' ),
		
	),
)); 
}}

?>


